<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <meta name="format-detection" content="telephone=no" />
    <title>挖矿列表</title>
    <link rel="stylesheet" href="../../css/reset.css">
    <style>
        body {
            width: 100%;
            background-color: #F8F8F8;
            font-family: Helvetica;
            color: #333333;
            font-size: 0.28rem;
            font-family: PingFang SC;
        }

        #listState {
            width: 100%;
            font-size: 0.25rem;
            text-align: center;
            color: #999999;
            padding: 10px 0;
            margin-top: 0.5rem;
        }

        .listState {
            width: 100%;
            font-size: 0.25rem;
            text-align: center;
            color: #999999;
            padding: 10px 0;
            margin-top: 0.2rem;
        }

        .snapupClass {
            background: url("../../image/bgbtcbhpxa.png") no-repeat center;
            background-size: cover;
        }

        .newPersen {
            background: url("../../image/bgbtcbhpxb.png") no-repeat center;
            background-size: cover;
        }

        .blackClass {
            background-color: #ffffff;
        }

        .intervalHour {
            width: 100%;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: center;
        }

        #goodslist {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
        }

        #showOrinList {
            width: 6.9rem;
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: center;
        }

        #showOrinList li {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: center;
            position: relative;
            background-color: #ffffff;
            border-radius: 0.1rem;
            margin-bottom: 0.2rem;
            overflow: hidden;
        }

        #showOrinList li>img {
            position: absolute;
            right: 0.13rem;
            top: 0.23rem;
            width: 1.91rem;
        }

        #showOrinList li>div:first-of-type {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: flex-start;
            box-sizing: border-box;
            padding: 0 0.35rem;
        }

        #showOrinList li>div:first-of-type>p:first-of-type {
            width: 100%;
            height: 0.6rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: flex-start;
            box-sizing: border-box;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            font-size: 0.28rem;
            font-family: PingFang SC;
            font-weight: bold;
            color: rgba(38, 38, 38, 1);
            margin-top: 0.2rem;
        }

        #showOrinList li>div:first-of-type>p:first-of-type span {
            max-width: 80%;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        .showTips {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: flex-start;
            position: relative;
        }

        .showTips>p:first-of-type {
            width: auto;
            height: auto;
            font-size: 0.22rem;
            font-family: PingFang SC;
            font-weight: 500;
            display: flex;
            display: -webkit-flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: flex-start;
        }

        .showTips>p:first-of-type>span {
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: center;
            flex-wrap: nowrap;
            box-sizing: border-box;
            padding: 0.04rem 0.12rem;
            background: rgba(253, 248, 236, 1);
            opacity: 0.99;
            color: rgba(216, 144, 5, 1);
            border-radius: 0.06rem;
            padding: 0 0.12rem;
            margin-top: 0.1rem;
        }

        .leastTimeInterval {
            position: absolute;
            right: 0;
            top: 0.06rem;
        }

        .setBg {
            background-color: #231C08;
            color: #ffffff;
            padding: 0.05rem;
            font-size: 0.2rem;
            border-radius: 2px;
            width: 0.5rem;
            height: 0.3rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: center;
        }

        .unitPower {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: center;
            margin-bottom: 0.1rem;
        }

        .unitPower p {
            width: 100%;
            height: 0.44rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: space-between;
            font-size: 0.24rem;
            font-family: PingFang SC;
            font-weight: 500;
            color: rgba(153, 153, 153, 1);
        }

        .unitPower p>span:last-of-type {
            font-size: 0.24rem;
            font-family: PingFang SC;
            font-weight: bold;
            color: rgba(89, 89, 89, 1);
        }


        #showOrinList li>div:last-of-type {
            width: 100%;
            height: 0.66rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: space-between;
            border-top: 1px solid #eeeeee;
            padding: 0 0.35rem;
            box-sizing: border-box;
            font-size: 0.24rem;
            font-family: PingFang SC;
            font-weight: 500;
            color: rgba(153, 153, 153, 1);
        }

        #showOrinList li>div:last-of-type>p>span:last-of-type {
            color: rgba(89, 89, 89, 1);
        }


        /* 转让算力 */

        #showmakeOverPower {
            width: 100%;
            height: auto;
            margin-top: 0.6rem;
        }

        #showmakeOverPower ul {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: center;
            padding: 0 0.3rem;
            box-sizing: border-box;
            justify-content: center;
        }

        #showmakeOverPower ul li {
            width: 100%;
            height: 3.2rem;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: center;
            padding: 0 0.3rem;
            box-sizing: border-box;
            justify-content: center;
            background-color: #fff;
            border-radius: 0.1rem;
        }

        #showmakeOverPower ul li>div {
            width: 100%;
        }

        #showmakeOverPower ul li>p {
            width: 100%;
            height: 0.66rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: flex-start;
        }

        #showmakeOverPower ul li>p img {
            width: 0.4rem;
            height: 0.4rem;
            border-radius: 100%;
            margin-right: 0.1rem;
        }

        #showmakeOverPower ul li>p span {
            color: #fff;
            padding: 0.08rem 0.1rem;
            font-size: 0.2rem;
            border-radius: 0.1rem;
            margin-left: 0.12rem;
        }

        #showmakeOverPower ul li>p span:first-of-type {
            background-color: #ffd203;
            margin-left: 0.3rem;
        }

        #showmakeOverPower ul li>p span:nth-of-type(2) {
            background-color: #ffb9a1;
        }

        #showmakeOverPower ul li>p span:last-of-type {
            background-color: #a5d780;
        }

        .showPrice {
            height: auto;
            margin-top: 0.1rem;
        }

        .showPrice div:first-of-type {
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: center;
        }

        .showPrice div:first-of-type>p {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: space-between;
            font-size: 0.24rem;
            font-family: PingFang SC;
            font-weight: 500;
            color: rgba(153, 153, 153, 1);
        }

        .showPrice div:first-of-type>p:not(:first-of-type) {
            margin-top: 0.06rem;
        }

        /* .showPrice div:last-of-type {
            width: 1.6rem;
            height: 100%;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: center;
        }

        .showPrice div:last-of-type b {
            height: 0.64rem;
            width: 1.5rem;
            border-radius: 0.1rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: center;
            background-color: #ffd203;
            font-weight: normal;
        } */

        #agreement ul p,
        #agreement ul span {
            line-height: 100%;
        }

        .container * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        .container {
            color: #262626;
            min-height: 100%;
            position: relative
        }

        #agreement ul,
        #agreement li {
            text-decoration: none;
            display: block;
        }

        #agreement .loadToast {
            padding: 0.4rem 0;
            color: #9e9b9b;
            text-align: center;
            font-size: 0.24rem;
        }

        #agreement #toast {
            position: fixed;
            z-index: 1;
            height: 0.7rem;
            line-height: 0.7rem;
            background: #FFFBED;
            padding: 0 0.32rem;
            width: 100%;
            color: #E19511;
            font-size: 0.26rem;
        }

        #agreement #toast img {
            width: 0.32rem;
            height: 0.32rem;
            vertical-align: middle;
            margin-left: 0.06rem
        }

        #agreement #toast span {
            line-height: 0.7rem;
            vertical-align: middle;
        }

        #agreement #list li {
            padding: 0 0.32rem;
            margin-top: 0.15rem;
            background: #fff;
        }

        #agreement #list li:first-child {
            margin-top: 0;
        }

        #agreement #list {
            padding: 0.7rem 0rem 0rem 0rem;
        }

        #agreement .managerTxt img {
            width: 0.25rem;
            height: 0.26rem;
        }

        #agreement .name,
        #agreement .managerTxt {
            font-size: 0.28rem;
        }

        #agreement .name {
            padding-top: 0.5rem;
            font-family: 'PingFang-SC-Bold';
            font-weight: bold;
        }

        #agreement .managerTxt {
            padding-top: 0.25rem;
        }

        #agreement .detail {
            overflow: hidden;
            position: relative;
            padding-top: 0.39rem;
        }

        #agreement .detail .title {
            color: #8E979E;
            font-size: 0.22rem;
        }

        #agreement .detail .content {
            color: #262626;
            font-size: 0.24rem;
        }

        #agreement .detail>span {
            float: left;
        }

        #agreement .detail>span:last-child {
            float: right;
        }

        #agreement .detail>span:nth-child(2),
        #agreement .detail>span:nth-child(3) {
            padding-left: 1.05rem;
            display: inline-block;
            width: 2.35rem;
        }

        #agreement #addTextClass li .detail:last-child {
            padding-top: 0.25rem;
            padding-bottom: 0.35rem;
        }

        .snapupClass {
            background: url("../../image/bgbtcbhpxa.png") no-repeat center;
            background-size: cover;
        }

        .newPersen {
            background: url("../../image/bgbtcbhpxb.png") no-repeat center;
            background-size: cover;
        }

        .blackClass {
            background-color: #ffffff;
        }

        .showStartPrice {
            width: 100%;
            height: 0.71rem;
            background-color: #ffffff;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: space-between;
            font-size: 0.24rem;
            font-family: PingFang SC;
            color: rgba(142, 151, 158, 1);
            border-top: 1px solid #F3F3F3;
            margin-top: 0.2rem;
        }
    </style>
</head>

<body>
    <div>
        <div id="showmakeOverPower" style="display: none;">
            <ul class="showmakeOverPower">
                <!-- <li style="margin-top:0.2rem;">
                <p>
                    <img src="../../image/cnyicnx.png"> <b class="userName" style="font-size: 0.24rem;"> 居然要昵称 </b>
                    <img src="../../image/cnyicnx.png" alt=""
                        style="width: auto;height: 0.4rem;margin-left: 0.1rem;border-radius: 0">
                    <span style="background-color:#ffd203;display:inline;margin-left: 0.1rem">双挖</span>
                    <span style="background-color:#a5d780;">达标上浮</span>
                </p>
                <div class="showPrice">
                    <div>
                        <p>
                            <span>
                                转让单价
                            </span>
                            <span style="color:#FF7C34;">
                                3000 CNY
                            </span>
                        </p>
                        <p>
                            <span>
                                转让总额
                            </span>
                            <span style="color:#FF7C34;">
                                0.00 CNY
                            </span>
                        </p>
                        <p>
                            <span>
                                分币比例
                            </span>
                            <span style="color: #626262">
                                50%
                            </span>
                        </p>
                        <p>
                            <span>
                                转让BTC算力 <span style="color: #262626;">6T</span>
                            </span>
                            <span>
                                转让BHP参配算力 <span style="color: #262626;">0T</span>
                            </span>
                        </p>
                        <p>
                            <span>
                                转让时间
                            </span>
                            <span style="color: #626262">
                                2020-05-22
                            </span>
                        </p>
                    </div>
                </div>
            </li> -->
            </ul>
            <div class="listState"></div>
        </div>
        <div id="goodslist" style="box-sizing: border-box;">
            <ul id="showOrinList"></ul>
            <div id="listState"></div>
        </div>
        <div style="display: none;" class="container" id="agreement">
            <div id="list">
                <ul id="addTextClass"></ul>
            </div>
            <p class="loadToast">到底了...</p>
        </div>
        <div class="mill-list"
            style="width:100%;height:99%;background-color: #fff;position: relative;top:0.4rem;display: none;">
            <div class="Nomachine"
                style="width:100%;display: flex;flex-direction: column; display:-webkit-flex;align-items: center;justify-content: center;position: fixed;top:15%;">
                <img src="../../image/orinover.png" style="width: 6.01rem;height: auto;">
            </div>
        </div>
        <div class="listService"
            style="width:100%;height:auto;background-color: #fff;position: relative;top:0.4rem;display: none;">
            <div class="Nomachine"
                style="width:100%;display: flex;flex-direction: column; display:-webkit-flex;align-items: center;justify-content: center;position: fixed;top:18%;">
                <img src="../../image/asgghdasd.png" id="shownoimg"
                    style="width: 3.22rem;height: auto;margin-top: 25%;">
            </div>
        </div>
    </div>
    <script src="../../script/autosize.js"></script>
    <script src="../../script/fastclick.js"></script>
    <script src="../../script/jquery_three_two_one.js"></script>
    <script src="../../script/dotmin.js"></script>
    <script src="../../script/app.js"></script>
    <script>
        apiready = function () {
            $("body").bind('touch click', function () {
                app.closeF('power_math');
            });
            var app = new APP();
            var account = app.getAccount();
            var openFrameHeight = app.accMul(2.4, document.getElementsByTagName("html")[0].style.fontSize.replace('px', ''));
            var sT = app.ST;
            if (app.showPhoneHead == false) {
                if (sT == "android") {
                    $(".head").css({
                        paddingTop: "0.25rem",
                        height: "0.7rem"
                    });
                } else {
                    $(".head").css({
                        paddingTop: "0.24rem",
                        height: "0.67rem"
                    });
                }
            }
            var page = 1;
            var dataArr = [];
            var countDownIds = [];
            var loadedNum = 0;
            var totalPage = 1;
            var numberNowInterval = null;
            var numberNow = Number(new Date());
            var headerChoose = "goBuy" //头部选择 默认为直购;
            // var chooseMoreType = "buyBack" //加密算力选择
            var chooseMoreType = "IPFS";
            var transferPage = 1; //转让页面当前页数
            var transferToatalPage = 0; //转让页面总页数
            var dataCheck = {}; //认证状态 //获取用户实名认证状态
            var machineID = "";//机器ID
            var machineNewType = "";//机器种类
            var machineUrl = "fisrt/item_detail";//页面路由
            var getDataNeed = {
                token: account ? account.token : "",
                page: transferPage,//当前页
                payCurrency: "",//支付方式
                isBhpPos: "All",//是否是双挖
                productDepositAd: 1,//按照转租单转出单价排序查询 1-降序 2-升序
                totalPowerAd: 1//按算力排序 1-降序 2-升序
            }

            function getBhpayAbout(machineSataus) {
                var getbhpStore = app.bhpayIsLine();
                if (getbhpStore == "true") {
                    if (machineNewType == "11" || machineNewType == "10") {
                        app.openWin({
                            name: "elec_detail",
                            url: app.hd + "mine/elec_detail" + ".html",
                            pageParam: {
                                itemId: machineID,
                                machineType: machineNewType
                            }
                        });
                        return false
                    }
                    if (machineSataus != "itemCanRent") return
                    if (machineUrl && machineID) {
                        app.openWin({
                            name: "item_detial",
                            url: app.hd + machineUrl + ".html",
                            pageParam: {
                                itemId: machineID,
                                machineType: machineNewType
                            }
                        });
                    }
                    return false
                }
                app.getBhpayAbout(function (ret) {
                    if (ret.code == 200 && ret.message == "success") {
                        if (machineNewType == "11" || machineNewType == "10") {
                            app.openWin({
                                name: "elec_detail",
                                url: app.hd + "mine/elec_detail" + ".html",
                                pageParam: {
                                    itemId: machineID,
                                    machineType: machineNewType
                                }
                            });
                            return false
                        }
                        if (machineSataus != "itemCanRent") return
                        if (machineUrl && machineID) {
                            app.openWin({
                                name: "item_detial",
                                url: app.hd + machineUrl + ".html",
                                pageParam: {
                                    itemId: machineID,
                                    machineType: machineNewType
                                }
                            });
                        }
                    } else {
                        var param = {
                            dtype: "dialog46",
                            data: {
                                eventText: "goConnectBhpay"
                            }
                        };
                        app.dialog(param);
                    }
                });
            };

            function getIsOpenDialog(machineSataus) {
                var account = app.getAccount();
                if (!account) {
                    app.toastDefi("该操作需要登录");
                    app.goLogin(true);
                    return false
                }
                app.appOpen(function (ret) {
                    if (ret.code == 200) {
                        if (ret.data.is_bhpay_check == 1) {
                            getBhpayAbout(machineSataus);
                        } else {
                            if (machineNewType == "11" || machineNewType == "10") {
                                app.openWin({
                                    name: "elec_detail",
                                    url: app.hd + "mine/elec_detail" + ".html",
                                    pageParam: {
                                        itemId: machineID,
                                        machineType: machineNewType
                                    }
                                });
                                return
                            }
                            if (machineSataus != "itemCanRent") return
                            if (machineUrl && machineID) {
                                app.openWin({
                                    name: "item_detial",
                                    url: app.hd + machineUrl + ".html",
                                    pageParam: {
                                        itemId: machineID,
                                        machineType: machineNewType
                                    }
                                });
                            }
                        }
                    } else {
                        app.toast(ret.message);
                    }
                })
            }

            function getOverTake(machineSataus) {
                var getbhpStore = app.bhpayIsLine();
                if (getbhpStore == "true") {
                    var pageValue = {
                        name: "undertaking_details",
                        subpage: "transactionpower/undertaking_details",
                        title: "合约包详情",
                        rightTitle: "支付方式",
                        rightIconUrl: "/image/chengjie.png",
                        param: {
                            pageName: "undertaking_details",
                            machineID: machineSataus,
                            rightParam: {
                                eventTrigger: "overTakingDialog"
                            }
                        }
                    }
                    app.setNavBarAttr(pageValue);
                    return
                }
                app.getBhpayAbout(function (ret) {
                    if (ret.code == 200 && ret.message == "success") {
                        app.bhpayIsLine("true");
                        var pageValue = {
                            name: "undertaking_details",
                            subpage: "transactionpower/undertaking_details",
                            title: "合约包详情",
                            rightTitle: "支付方式",
                            rightIconUrl: "/image/chengjie.png",
                            param: {
                                pageName: "undertaking_details",
                                machineID: machineSataus,
                                rightParam: {
                                    eventTrigger: "overTakingDialog"
                                }
                            }
                        }
                        app.setNavBarAttr(pageValue);
                    } else {
                        app.toast(ret.message);
                        app.bhpayIsLine("false");
                        var param = {
                            dtype: "dialog46",
                            data: {
                                eventText: "goConnectBhpay"
                            }
                        };
                        app.dialog(param);
                    }
                });
            };

            function getIsOpenOverTaken(machineSataus) {
                var account = app.getAccount();
                if (!account) {
                    return false
                }
                app.appOpen(function (ret) {
                    if (ret.code == 200) {
                        if (ret.data.is_bhpay_check == 1) {
                            getOverTake(machineSataus);
                        } else {
                            var pageValue = {
                                name: "undertaking_details",
                                subpage: "transactionpower/undertaking_details",
                                title: "合约包详情",
                                rightTitle: "支付方式",
                                rightIconUrl: "/image/chengjie.png",
                                param: {
                                    pageName: "undertaking_details",
                                    machineID: machineSataus,
                                    rightParam: {
                                        eventTrigger: "overTakingDialog"
                                    }
                                }
                            }
                            app.setNavBarAttr(pageValue);
                        }
                    } else {
                        app.toast(ret.message);
                    }
                })
            }

            //矿机列表(可回购)
            function loadPage(return_type) {
                app.ajaxPro({
                    url: "machine/lists",
                    values: {
                        token: account ? account.token : "",
                        return_type: return_type  //1可回购 ，2不可回购
                    },
                    openFlower: true
                }, function (ret) {
                    if (ret.code == 200) {
                        dataArr = ret.data.list;
                        // for (var i = 0; i < ret.data.list.length; i++) {
                        //     ret.data.list[i].loadedNum = loadedNum;
                        // }
                        ret.data.list.map(function (item, index) {
                            ret.data.list[index].loadedNum = loadedNum;
                            // item.prentNum = app.accMul(app.accAdd(item.float_power, item.regular_power), 100);
                            if (item.num_left <= 0) {
                                //售罄
                                item.orinStaus = "sellOut";
                            } else {
                                var openTime = numberDate(item.panic_buying_time.replace(/-/g, "/"));
                                item.now = numberNow;
                                item.openTime = openTime;
                                var isWait = openTime - numberNow;
                                item.isWait = isWait;
                                if (item.time_left > 0) {
                                    //待开放
                                    item.orinStaus = "waitOpen";
                                } else {
                                    item.orinStaus = "itemCanRent";
                                }
                            }
                            if (item.is_only_newbie == 1) {
                                item.bgClass = "newPersen"
                            } else {
                                if (item.is_bhp_pos == 1 && item.orinStaus == "waitOpen") {
                                    item.bgClass = "snapupClass"
                                } else {
                                    item.bgClass = "blackClass"
                                }
                            }
                            item.num_leftTotalPower = app.accMul(item.base_power, item.num_left);
                            for (var i = 0; i < item.good_deposit.length; i++) {
                                if (item.good_deposit[i].pay_currency == "USDT") {
                                    if (String(item.good_deposit[i].goods_deposit).indexOf(".") != -1) {
                                        if (item.good_deposit[i].goods_deposit.split(".")[1] * Math.pow(10, 4) > 1) {
                                            item.usdtPrice = item.good_deposit[i].goods_deposit
                                        } else {
                                            item.usdtPrice = item.good_deposit[i].goods_deposit.split(".")[0]
                                        }
                                    } else {
                                        item.usdtPrice = item.good_deposit[i].goods_deposit
                                    }
                                }
                                if (item.good_deposit[i].pay_currency == "CNY") {
                                    if (String(item.good_deposit[i].goods_deposit).indexOf(".") != -1) {
                                        if (item.good_deposit[i].goods_deposit.split(".")[1] * Math.pow(10, 4) > 1) {
                                            item.cnyPrice = item.good_deposit[i].goods_deposit
                                        } else {
                                            item.cnyPrice = item.good_deposit[i].goods_deposit.split(".")[0]
                                        }
                                    } else {
                                        item.cnyPrice = item.good_deposit[i].goods_deposit
                                    }
                                }
                            }
                            if (item.type == 11 || item.type == 10) {
                                if (item.type == 11) {
                                    item.elecPriceCny = app.sliceNum(item.electric_price.CNY, 2);
                                    item.todayElecCny = app.accMoreMul(item.electric_price.CNY, item.mine_power, 24, item.base_power);//每日电费
                                    item.elecPriceUsdt = item.electric_price.USDT;
                                }
                                var predict_income_level = item.predict_income_level;
                                var minNum = predict_income_level[0].income_rate;//数组最小值
                                var maxNum = predict_income_level[0].income_rate;//数组最大值
                                for (var i in predict_income_level) {
                                    var itemnew = predict_income_level[i];
                                    if (itemnew.income_rate < minNum) {
                                        minNum = itemnew.income_rate;
                                    }
                                    if (itemnew.income_rate > maxNum) {
                                        maxNum = itemnew.income_rate;
                                    }
                                }
                                maxNumRateNum = app.sliceNum(app.accMul(maxNum, 100), 2);//净收益率最大值
                                minNumRateNum = app.sliceNum(app.accMul(minNum, 100), 2);//最小值
                                item.income_ratePre = minNumRateNum + "% ~ " + maxNumRateNum;
                            }
                        })
                        var temp = doT.template($("#listTpl").text());
                        $("#goodslist > ul").html(temp(ret.data.list));
                        setStatus();
                        loadedNum += dataArr.length;
                        // 如果是第一页，并且没有数据
                        if (page == 1 && ret.data.list.length == 0 && return_type == 1) {
                            $("#listState").text("").css("height", 0);
                            $(".mill-list").show().css("display", "flex");
                            $("#listState").hide();
                        } else {
                            $("#listState").css("height", "auto").text("没有更多了");
                            $(".mill-list").hide();
                            $("#listState").show();
                        }
                    }
                });
            }

            // loadPage(1);
            //IPFS矿机加载 
            function loadIpfs(params) {
                $("body>div").hide();
                app.ajaxPro({
                    url: "ipfs/index",
                    values: {
                        token: account ? account.token : ""
                    },
                    openFlower: true
                }, function (ret) {
                    if (ret.code == 200) {
                        var uri = ret.data.url;
                        // console.log('ret'+JSON.stringify(ret))
                        var powerIndexH = app.orinDailogHH - 10;
                        var Ipfs_Y = app.H * 0.13 + powerIndexH;
                        if (headerChoose == 'overTake') {
                            Ipfs_Y = app.H * 0.23 + powerIndexH;
                            if (app.ST == "ios" && app.isiPhone10 == true) {
                                Ipfs_Y = app.H * 0.22 + powerIndexH;
                            }
                        }
                        app.openFrame({
                            name: "IPFS_frame",
                            url: uri,
                            bgColor: "",
                            rect: {
                                x: 0,
                                y: Ipfs_Y,
                                w: app.W,
                                marginBottom: app.safetyFooterArea + 55,
                            }
                        });
                    }
                });
            }
            loadIpfs();
            //获取转让列表
            function getTransferData(isdown, getDataNeed) {
                $(".mill-list").hide();
                app.ajaxPro({
                    url: "transfer/lists",
                    values: getDataNeed,
                    openFlower: true
                }, function (ret) {
                    if (ret.code == 200) {
                        transferToatalPage = ret.data.totalPage;
                        var myTdPower = ret.data.userAge;
                        var thisList = ret.data.list;
                        thisList.map(function (item, index) {
                            item.username = item.fromUsername.length > 10 ? (item.fromUsername.slice(0, 6) + "…") : item.fromUsername;
                            item.myTdPower = myTdPower;//用户算龄
                            item.mechine = JSON.stringify(item);
                            item.total_power = app.accMul(item.basePower, item.num);
                            item.bhpPower = app.accMul(item.bhpPower, item.num);
                            item.distributionRate = app.accMul(item.distributionRate, 100);
                            item.productDeposit = app.accDiv(item.productDeposit, item.basePower);
                            item.total_deposit = app.accMul(item.productDeposit, item.total_power);
                            if (item.paymentCurrencyCode != "USDT") {
                                item.total_deposit = app.sliceNum(item.total_deposit, 2);
                                item.goods_deposit = app.sliceNum(item.productDeposit, 2);
                            } else {
                                item.total_deposit = app.sliceNum(item.total_deposit, 4);
                                item.goods_deposit = app.sliceNum(item.productDeposit, 4);
                            }
                            var imgArr = ['grade_one.png', 'grade_two.png', 'grade_three.png', 'grade_four.png', 'grade_five.png', 'grade_six.png'];
                            var grade = Number(item.user_level) - 1;
                            item.gradeImg = '../../image/' + imgArr[grade];
                        });
                        // 渲染模板
                        var temp = doT.template($("#tranferListData").text());
                        if (isdown) {
                            $(".showmakeOverPower").html(temp(thisList));
                        } else {
                            $(".showmakeOverPower").append(temp(thisList));
                        }
                        if (transferPage == 1 && thisList.length == 0) {
                            $(".listState").text("暂时没有相关数据");
                        }
                        if (transferPage < transferToatalPage) {
                            $(".listState").text("加载更多");
                        }
                        if (transferPage >= transferToatalPage) {
                            $(".listState").text("没有更多数据了");
                        }
                    } else {
                        app.toast(ret.message)
                    }

                })
            }

            function numberDate(d) {
                return Number(new Date(d));
            }

            //倒计时
            function setStatus() {
                for (var i = 0; i < dataArr.length; i++) {
                    if (dataArr[i].orinStaus == "waitOpen") {
                        var timeLast = dataArr[i].time_left;
                        var ii = i + loadedNum;
                        (function (id, timeLast) {
                            var timer = new app.COUNTDOWN(timeLast);
                            if (timeLast && timeLast > 0) {
                                $("#button" + id).removeClass("next").addClass("inputNull").attr("data-url", "");
                                timer.start(
                                    function (ret, err) {
                                        if (ret > 0) {
                                            var timeArr = app.getDuration(ret).split(":");
                                            $("#button" + id).find(".leastHour").text(timeArr[0]);
                                            $("#button" + id).find(".leastMin").text(timeArr[1]);
                                            $("#button" + id).find(".leastSes").text(timeArr[2]);
                                        } else {
                                            $("#button" + id).css({
                                                display: "none"
                                            });
                                            $("#listItemNew" + id).attr("data-stutas", "itemCanRent");
                                        }
                                    },
                                    function (index) {
                                        countDownIds.push(index);
                                    }
                                );
                            }
                        })(ii, timeLast);
                    }
                }
            }
            var thisItem = {
                isBhp: 0,
                thisID: ""
            }//保存相关数据
            //转让点击
            $("#showmakeOverPower").on("click", "li", function () {
                if (app.ST == "ios") {
                    app.ajAnalytics.onEvent({
                        eventType: "calculate",
                        eventId: 'transferlist',
                        attrs: { "transferlist": "transferlist" },
                        value: 1
                    }, function (ret, err) {
                        console.log(JSON.stringify(ret));
                    });
                } else {
                    app.ajAnalytics.onEvent({
                        eventType: "calculate",
                        eventId: 'transferlistanzhuo',
                        attrs: { "transferlistanzhuo": "transferlistanzhuo" },
                        value: 1
                    }, function (ret, err) {
                        console.log(JSON.stringify(ret));
                    });
                }
                var thisStstus = $(this).attr("data-status");
                var mypower = Number($(this).attr("data-power"));
                var isBhp = $(this).attr("data-isPos");
                var isSelf = $(this).attr("data-isSelf");
                thisItem.thisID = $(this).attr("data-machineID");
                thisItem.isBhp = isBhp;
                if (thisStstus == 1) return
                if (isSelf == 1) {
                    app.toast("自己转让的订单,无法承接");
                    return
                }
                //算龄小于1000并且是双挖弹窗
                if (mypower < 1000 && isBhp == 1) {
                    var param = {
                        dtype: "dialog11",
                        data: {
                            title: "提示",
                            text: "您的算力未达到<span style='color:#FF4E4E;'>1000 TD</span>，算龄达标前，只有单挖产出",
                            btns: [{
                                name: "取消",
                                event: "canalOt"
                            }, {
                                name: "确定",
                                event: "rentOt"
                            }]
                        }
                    };
                    app.dialog(param);
                    return
                }
                app.trigger("rentOt");
            })
            app.listen("rentOt", function () {
                if (thisItem.isBhp != 1) {
                    var pageValue = {
                        name: "undertaking_details",
                        subpage: "transactionpower/undertaking_details",
                        title: "合约包详情",
                        rightIconUrl: "/image/chengjie.png",
                        rightTitle: "支付方式",
                        param: {
                            pageName: "undertaking_details",
                            machineID: thisItem.thisID,
                            machine: $(this).attr("data-mechine"),
                            rightParam: {
                                eventTrigger: "overTakingDialog"
                            }
                        }
                    }
                    app.setNavBarAttr(pageValue);
                } else {
                    getIsOpenOverTaken(thisItem.thisID)
                }
            })
            //市场点击
            $("#showOrinList").on("click", "li", function () {
                var thisMathStatus = $(this).attr("data-stutas");
                if (thisMathStatus == "sellOut") return
                machineNewType = $(this).attr("data-machineType");
                var machineType = $(this).attr("data-machineType");
                machineID = $(this).attr("data-id");
                var itemId = $(this).attr("data-id");
                var isBHPmachien = $(this).attr("data-isBhp");
                machineUrl = $(this).attr("data-url");
                var itemUrl = $(this).attr("data-url");
                if (isBHPmachien != "yes") {
                    if (machineType == "11" || machineType == "10") {
                        if (app.ST == "ios") {
                            app.onEvent("calculate", "hightbtcmachine");
                        } else {
                            app.onEvent("calculate", "hightbtcmachineanzhuo");
                        }
                        app.openWin({
                            name: "elec_detail",
                            url: app.hd + "mine/elec_detail" + ".html",
                            pageParam: {
                                itemId: itemId,
                                machineType: machineType
                            }
                        });
                        return
                    }
                    if (app.ST == "ios") {
                        app.onEvent("calculate", "btcmachine");
                    } else {
                        app.onEvent("calculate", "btcmachineanzhuo");
                    }
                    if (itemUrl && itemId) {
                        app.openWin({
                            name: "item_detial",
                            url: app.hd + itemUrl + ".html",
                            pageParam: {
                                itemId: itemId,
                                machineType: machineType
                            }
                        });
                    }
                } else {
                    getIsOpenDialog($(this).attr("data-stutas"));
                }
            });
            var ag_data = [], page3 = 1, t_page = 1;
            function loadContract(page, isdown) {
                if (isdown) {
                    $("#addTextClass").html('');
                    ag_data = [];
                }
                app.closeFlower();
                $(".loadToast").text("没有更多了");
                return
                app.ajaxPro({
                    url: "insurance/get-insurance",
                    values: {
                        token: account.token,
                        page: page,
                        pageSize: 10
                    },
                    openFlower: true
                }, function (ret) {
                    if (ret.code == 200) {
                        if (isdown) {
                            app.stopRefresh();
                        }
                        page3++;
                        t_page = ret.data.totalPage;
                        for (var i = 0; i < ret.data.body.length; i++) {
                            ag_data.push(ret.data.body[i]);
                        }
                        var temp = doT.template($("#md").text());
                        $("#addTextClass").html(temp(ag_data));
                        if (page3 == 1 && ret.data.body.length == 0) {
                            $(".loadToast").text("").css("height", 0);
                            $(".listService").show().css("display", "flex").find("img").attr("src", "../../image/asgghdasd.png");
                            $(".loadToast").hide();
                        } else {
                            $(".loadToast").css("height", "auto").text("没有更多了");
                            $(".listService").hide();
                            $(".loadToast").show();
                        }
                        if (page < t_page && t_page > 1) {
                            $(".loadToast").text("加载更多");
                        }
                        if (page == t_page && t_page > 1) {
                            $(".loadToast").text("没有更多了");
                        }
                    }
                });
            }

            app.listen('loadAg', function () {
                loadContract(0, true);
            });
            $("#addTextClass").on("click", "li", function () {
                app.setStorage("chooseService", {
                    chooseArr: [],
                    totalpower: 0
                });
                var pageValue = {
                    name: "contract_service",
                    subpage: "mine/contract_service",
                    title: "关联算力包",
                    param: {
                        pageName: "contract_service",
                        id: $(this).attr("data-id"),//选择算力包Id
                        nameService: $(this).attr("data-name"),//关联算力包名称
                        userService: $(this).attr("data-user"),// 合约销售方
                        isOrinPage: 'true',//是否矿机列表打开的,
                        constractId: $(this).attr("data-constractId")//合同ID
                    },
                };
                app.setNavBarAttr(pageValue);
            })
            // 监听滚动到底部
            app.toBottom(function () {
                if (chooseMoreType == "IPFS") return;
                app.log("rent", "curPage：" + page + " totalPage：" + totalPage + "转让页面" + transferPage + "-----" + transferToatalPage);
                if (headerChoose == "overTake") {
                    if (transferPage < transferToatalPage) {
                        transferPage++;
                        getDataNeed.page = transferPage;
                        getTransferData(false, getDataNeed);
                    }
                } else if (headerChoose == 'contract') {
                    if (page3 < t_page) {
                        loadContract(page3, false);
                    }
                } else {
                    return
                }
            });
            app.downRefresh(function () {
                $("body div ul").empty();
                $("body").scrollTop(0);
                $(".listService").hide();
                if (chooseMoreType == "IPFS" || (headerChoose == "overTake" && chooseMoreType == "noBuyBack")) {
                    app.stopRefresh();
                    return
                }
                if (headerChoose == "overTake") {
                    transferPage = 1;
                    transferToatalPage = 0;
                    getDataNeed.page = transferPage;
                    $(".showmakeOverPower").empty();
                    getTransferData(true, getDataNeed);
                } else if (headerChoose == 'contract') {
                    page3 = 0;
                    t_page = 1;
                    loadContract(page, true);
                } else {
                    loadedNum = 0;
                    page = 1;
                    $("#goodslist > ul").empty();
                    $("#listState").css("height", "auto");
                    // 清除所有定时器
                    for (var i = 0; i < countDownIds.length; i++) {
                        window.clearInterval(countDownIds[i]);
                    }
                    countDownIds.length = 0;
                    if (chooseMoreType == "buyBack") {
                        loadPage(1);
                    } else {
                        loadPage(2);
                    }
                }
            });
            app.listen("reloadOrin", function () {
                app.reload();
            });
            var lisenEveent = ["elec_success", "rent_success"];
            app.listen(lisenEveent, function () {
                if (chooseMoreType == "IPFS") {
                    app.stopRefresh();
                    return
                }
                $("body div ul").empty();
                $("body").scrollTop(0);
                if (headerChoose == "overTake") {
                    transferPage = 1;
                    transferToatalPage = 0;
                    getDataNeed.page = transferPage;
                    $(".showmakeOverPower").empty();
                    getTransferData(true, getDataNeed);
                } else if (headerChoose == 'contract') {
                    page3 = 0;
                    t_page = 1;
                    loadContract(page, true);
                } else {
                    loadedNum = 0;
                    page = 1;
                    $("#goodslist > ul").empty();
                    $("#listState").css("height", "auto");
                    // 清除所有定时器
                    for (var i = 0; i < countDownIds.length; i++) {
                        window.clearInterval(countDownIds[i]);
                    }
                    countDownIds.length = 0;
                    if (chooseMoreType == "buyBack") {
                        loadPage(1);
                    } else {
                        loadPage(2);
                    }
                }
            })
            //监听转让专区的算力和价格的选择
            app.listen("transferChoose", function (ret) {
                if (chooseMoreType == "IPFS" || (chooseMoreType == "noBuyBack" && headerChoose == "overTake")) {
                    $(".showmakeOverPower,#showOrinList,#addTextClass").empty();
                    $("#listState,.listState,.loadToast").text("");
                    $(".listService").show().css("display", "flex").find("img").attr("src", "../../image/blankpage.png");
                    return
                }
                $(".listService").hide();
                $("body div ul").empty();
                transferPage = 1;
                transferToatalPage = 0;
                getDataNeed.page = transferPage;
                getDataNeed.totalPowerAd = ret.value.transferpower;
                getDataNeed.productDepositAd = ret.value.transferprice;
                $("body").scrollTop(0);
                $(".showmakeOverPower").empty();
                getTransferData(true, getDataNeed);
            });

            //监听转让专区的筛选
            app.listen("chooseOrinItem", function (ret) {
                if (chooseMoreType != "buyBack") {
                    $(".showmakeOverPower,#showOrinList,#addTextClass").empty();
                    $("#listState,.listState,.loadToast").text("");
                    $(".listService").show().css("display", "flex").find("img").attr("src", "../../image/blankpage.png");
                    return
                }
                $("body").scrollTop(0);
                $(".showmakeOverPower").empty();
                $(".listService").hide();
                $("body div ul").empty();
                transferPage = 1;
                transferToatalPage = 0;
                getDataNeed.page = transferPage;
                getDataNeed.isBhpPos = ret.value.worktype;
                getDataNeed.payCurrency = ret.value.payMethod;
                getTransferData(true, getDataNeed);
            });
            app.listen("orinChoose", function (ret) {
                headerChoose = ret.value.transaction;//市场种类筛选
                chooseMoreType = ret.value.chooseType;//可回购算力 不可回购算力筛选
                var boxMarginTop = app.H * 0.2;
                if (app.ST == "ios" && app.isiPhone10 == true) {
                    boxMarginTop = app.H * 0.16;
                }
                if (sT != "ios") {
                    boxMarginTop = app.H * 0.24;
                }
                if (headerChoose == "goBuy") {
                    $("#goodslist").css("marginTop", boxMarginTop);
                }
                if (headerChoose == "overTake" && chooseMoreType == "buyBack") {
                    $("#showmakeOverPower").css("marginTop", boxMarginTop + 30)
                }
                if (chooseMoreType == "IPFS") {
                    app.closeF("power_index");
                }
                if (chooseMoreType != "IPFS" && headerChoose == "goBuy") {
                    app.openFrame({
                        name: "power_index",
                        url: app.hd + "mainpage/power_index.html",
                        bgColor: "",
                        rect: {
                            x: 0,
                            y: app.H * 0.17,
                            w: app.W,
                            h: app.orinDailogHH
                        }, pageParam: {
                            is_contact: "false"
                        }
                    });
                }
                if (chooseMoreType != "IPFS" && headerChoose != "goBuy") {
                    var openFrameHeight12 = app.accMul(2.7, document.getElementsByTagName("html")[0].style.fontSize.replace('px', ''));
                    var safetyArea = app.H * 0.23;
                    if (app.ST == "ios" && app.isiPhone10 == true) {
                        safetyArea = app.H * 0.22;
                    }
                    app.openFrame({
                        name: "power_index",
                        url: app.hd + "mainpage/power_index.html",
                        bgColor: "",
                        rect: {
                            x: 0,
                            y: safetyArea,
                            w: app.W,
                            h: app.orinDailogHH - 3
                        },
                        pageParam: {
                            is_contact: "true"
                        }
                    });
                }
                if (chooseMoreType == "IPFS" && headerChoose != "goBuy") {
                    app.closeF('IPFS_frame');
                    $("body>div").show();
                    $(".showmakeOverPower,#showOrinList,#addTextClass").empty();
                    $("#listState,.listState,.loadToast").text("");
                    $(".listService").show().css("display", "flex").find("img").attr("src", "../../image/blankpage.png");
                    return
                }
                if (chooseMoreType == "noBuyBack" && headerChoose == "overTake") {
                    app.closeF('IPFS_frame');
                    $(".showmakeOverPower,#showOrinList,#addTextClass").empty();
                    $("#listState,.listState,.loadToast").text("");
                    $(".listService").show().css("display", "flex").find("img").attr("src", "../../image/blankpage.png");
                    return
                }
                $("body div ul").empty();
                $(".listService").hide();
                if (chooseMoreType == "IPFS" && headerChoose == 'goBuy') {
                    $("body>div").hide();
                    app.ajaxPro({
                        url: "ipfs/index",
                        values: {
                            token: account ? account.token : ""
                        },
                        openFlower: true
                    }, function (ret) {
                        if (ret.code == 200) {
                            var uri = ret.data.url;
                            var powerIndexH = app.orinDailogHH - 10;
                            var Ipfs_Y = app.H * 0.13 + powerIndexH;
                            if (headerChoose == 'overTake') {
                                Ipfs_Y = app.H * 0.23 + powerIndexH;
                                if (app.ST == "ios" && app.isiPhone10 == true) {
                                    Ipfs_Y = app.H * 0.22 + powerIndexH;
                                }
                            }
                            app.openFrame({
                                name: "IPFS_frame",
                                url: uri,
                                bgColor: "",
                                rect: {
                                    x: 0,
                                    y: Ipfs_Y,
                                    w: app.W,
                                    marginBottom: app.safetyFooterArea + 55,
                                }
                            });
                        }
                    });
                } else {
                    app.closeF('IPFS_frame');
                    $("body>div").show();
                }
                if (headerChoose == "overTake") {
                    if (!app.isLogin()) {
                        // 跳转登录页面
                        app.toast("该操作需要登录");
                        app.goLogin(true);
                        return;
                    }
                    var c2CDialog = app.getSyncStorage("c2CDialog");
                    if (!c2CDialog || c2CDialog == "false") {
                        var param = {
                            dtype: "dialog73",
                            stopPropagation: true,//阻止点击body冒泡
                        };
                        app.dialog(param);
                    }
                    chooseMoreType = "buyBack";
                    $(".showmakeOverPower").empty();
                    $("#showmakeOverPower").show();
                    $("#agreement").hide();
                    $("#goodslist").hide();
                    getTransferData(true, getDataNeed);
                } else if (headerChoose == 'contract') {
                    page3 = 0;
                    t_page = 1;
                    var tar = $("#agreement");
                    tar.siblings('div').hide();
                    tar.show();
                    loadContract(page3, true);
                } else {
                    loadedNum = 0;
                    page = 1;
                    $("#goodslist").show();
                    $("#showmakeOverPower").hide();
                    $("#agreement").hide();
                    $("#goodslist > ul").empty();
                    $("#listState").css("height", "auto");
                    // 清除所有定时器
                    for (var i = 0; i < countDownIds.length; i++) {
                        window.clearInterval(countDownIds[i]);
                    }
                    countDownIds.length = 0;
                    if (chooseMoreType == "noBuyBack") {
                        loadPage(2);
                    } else {
                        loadPage(1);
                    }
                }
            });
            app.listen("backFirstnew", function () {
                if (!app.isLogin()) {
                    return;
                }
                account = app.getAccount();
                if (chooseMoreType == "IPFS" && headerChoose == 'goBuy') {
                    app.closeF('IPFS_frame');
                    app.ajaxPro({
                        url: "ipfs/index",
                        values: {
                            token: account ? account.token : ""
                        },
                        openFlower: true
                    }, function (ret) {
                        if (ret.code == 200) {
                            var uri = ret.data.url;
                            var powerIndexH = app.orinDailogHH - 10;
                            var Ipfs_Y = app.H * 0.13 + powerIndexH;
                            if (headerChoose == 'overTake') {
                                Ipfs_Y = app.H * 0.23 + powerIndexH;
                                if (app.ST == "ios" && app.isiPhone10 == true) {
                                    Ipfs_Y = app.H * 0.22 + powerIndexH;
                                }
                            }
                            app.openFrame({
                                name: "IPFS_frame",
                                url: uri,
                                bgColor: "",
                                rect: {
                                    x: 0,
                                    y: Ipfs_Y,
                                    w: app.W,
                                    marginBottom: app.safetyFooterArea + 55,
                                }
                            });
                        }
                    });
                    return false
                }
                getDataNeed = {
                    token: account ? account.token : "",
                    page: transferPage,//当前页
                    payCurrency: "",//支付方式
                    isBhpPos: "All",//是否是双挖
                    productDepositAd: 1,//按照转租单转出单价排序查询 1-降序 2-升序
                    totalPowerAd: 1//按算力排序 1-降序 2-升序
                }
                if (headerChoose == "overTake") {
                    var c2CDialog = app.getSyncStorage("c2CDialog");
                    if (!c2CDialog || c2CDialog == "false") {
                        var param = {
                            dtype: "dialog73",
                            stopPropagation: true,//阻止点击body冒泡
                        };
                        app.dialog(param);
                    }
                    chooseMoreType = "buyBack";
                    $(".showmakeOverPower").empty();
                    $("#showmakeOverPower").show();
                    $("#agreement").hide();
                    $("#goodslist").hide();
                    getTransferData(true, getDataNeed);
                }
            })
            // //监听从后台回到前台
            app.listen("orinPageReload", function () {
                if (chooseMoreType == "IPFS" || (chooseMoreType == "noBuyBack" && headerChoose == "overTake")) {
                    app.stopRefresh();
                    return
                }
                $("body div ul").empty();
                $("body").scrollTop(0);
                if (chooseMoreType == "IPFS") {
                    $("body>div").hide();
                    app.ajaxPro({
                        url: "ipfs/index",
                        values: {
                            token: account.token || ""
                        },
                        openFlower: true
                    }, function (ret) {
                        if (ret.code == 200) {
                            var uri = ret.data.url;
                            var powerIndexH = app.orinDailogHH - 10;
                            var Ipfs_Y = app.H * 0.17 + powerIndexH;
                            if (headerChoose == 'overTake') {
                                Ipfs_Y = app.H * 0.23 + powerIndexH;
                                if (app.ST == "ios" && app.isiPhone10 == true) {
                                    Ipfs_Y = app.H * 0.22 + powerIndexH;
                                }
                            }
                            app.openFrame({
                                name: "IPFS_frame",
                                url: uri,
                                bgColor: "",
                                rect: {
                                    x: 0,
                                    y: Ipfs_Y,
                                    w: app.W,
                                    marginBottom: app.safetyFooterArea + 55,
                                }
                            });
                        }
                    });
                } else {
                    app.closeF('IPFS_frame');
                    $("body>div").show();
                }
                if (headerChoose == "overTake") {
                    transferPage = 1;
                    transferToatalPage = 0;
                    getDataNeed.page = transferPage;
                    $(".showmakeOverPower").empty();
                    getTransferData(true, getDataNeed);
                } else if (headerChoose == 'contract') {
                    page3 = 0;
                    t_page = 1;
                    loadContract(page, true);
                } else {
                    loadedNum = 0;
                    page = 1;
                    $("#goodslist > ul").empty();
                    $("#listState").css("height", "auto");
                    // 清除所有定时器
                    for (var i = 0; i < countDownIds.length; i++) {
                        window.clearInterval(countDownIds[i]);
                    }
                    countDownIds.length = 0;
                    if (chooseMoreType == "buyBack") {
                        loadPage(1);
                    } else {
                        loadPage(2);
                    }
                }
            });
            //监听从承接成功页面回到本页
            app.listen("goTranfer", function () {
                transferPage = 1;
                transferToatalPage = 0;
                getDataNeed.page = transferPage;
                $("#goodslist").hide();
                $("#showmakeOverPower").show();
                $(".showmakeOverPower").empty();
                getTransferData(true, getDataNeed);
            })
            //监听关联Bhpay
            app.listen("goConnectBhpay", function () {
                app.checkStausOther(function (ret, err) {
                    dataCheck = {
                        statusCode: ret.code,
                        statusText: ret.message
                    };
                    if (dataCheck.statusCode == 609 || dataCheck.statusCode == 614) {
                        var param = {
                            dtype: "dialog251",
                            data: {
                                text: "提示",
                                tipsText: "您暂未实名，请去【安全设置-实名认证】进行实名。",
                                btns: [{
                                    name: "取消",
                                    event: "canleminePageCheck"
                                }, {
                                    name: "确认",
                                    event: "gominePageCheck"
                                }]
                            }
                        };
                        app.dialog(param);
                    } else if (dataCheck.statusCode == 602) {
                        app.toast("亲,你的信息正在审核中……");
                    } else if (dataCheck.statusCode == 200) {
                        app.getBhpayURL(account, function (ret) {
                            if (ret.code == 200) {
                                app.closeDialog();
                                app.openWin({
                                    name: "browser_headerwin",
                                    url: app.hd + "common/headerwin.html",
                                    pageParam: {
                                        subpage: ret.data,
                                        name: "browser",
                                        type: "remote",
                                        isremote: "true",
                                        title: "BHPay",
                                        openBHpay: 'true'
                                    }
                                });
                                // var param = {
                                //     name: "BHPayBorser",
                                //     url: ret.data,
                                //     title: "BHPay",
                                //     param: {
                                //         openBHpay: 'true'
                                //     }
                                // }
                                // app.setNavBarAttrPrimary(param);
                            } else {
                                app.toast(ret.message);
                            }
                        })
                    } else {
                        var param = {
                            dtype: "dialog251",
                            data: {
                                text: "提示",
                                tipsText: "您暂未实名，请去【安全设置-实名认证】进行实名。",
                                btns: [{
                                    name: "取消",
                                    event: "canleminePageCheck"
                                }, {
                                    name: "确认",
                                    event: "gominePageCheck"
                                }]
                            }
                        };
                        app.dialog(param);
                    }
                })
            });
            var listencheck = ["canleminePageCheck", "gominePageCheck", "cancelDailog"];
            app.listen(listencheck, function () {
                app.closeDialog();
            })
        };
    </script>
    <!--直接购买-->
    <script type="text/html" id="listTpl">
    {{~it:item:index}}
    <li id="listItemNew{{=item.loadedNum+index}}" data-stutas="{{=item.orinStaus}}" data-id="{{=item.machine_id}}"
        data-url="fisrt/item_detail" data-machineType="{{=item.type}}"
        data-isBhp="{{=item.is_bhp_pos == 1?'yes':'no'}}">
        <div class="defaultbg {{=item.bgClass}}">
            <p>
                {{?item.is_bhp_pos==1}}
                <img src="../../image/iconbsasx.png" style="width: 0.67rem;height: 0.3rem;border-radius:0.08rem;">
                {{??}}
                {{?item.currency_code=="BTC"}}
                <img src="../../image/iconasxx.png" style="width: 0.3rem;height: 0.3rem;border-radius:0.08rem;">
                {{??item.currency_code=="ETH"}}
                <img src="../../image/iconcethx.png" style="width: 0.3rem;height: 0.3rem;border-radius:0.08rem;">
                {{??}}
                <img src="../../image/icondltcx.png" style="width: 0.3rem;height: 0.3rem;border-radius:0.08rem;">
                {{?}}
                {{?}}
                <span style="margin:0 0.1rem">
                            {{=item.name}}
                        </span>
                {{?item.is_only_newbie == 1}}
                <img src="../../image/icongiftx.png" style="width: 0.44rem;height: 0.46rem;">
                {{?}}
            </p>
            <div class="showTips">
                <p>
                    {{?item.insurance_id}}
                    <span style="margin-right:0.1rem;background:linear-gradient(-90deg,rgba(252,162,50,1),rgba(255,184,32,1));color:#ffffff;">
                        收益保障
                    </span>
                    {{?}}
                    {{?(item.type == 10 || item.type == 11)}}
                    <!-- <span style="margin-right:0.1rem;">
                        不可回购
                    </span> -->
                    <span>
                        合约期{{=item.regular_date_num}}天
                    </span>
                    {{??}}
                    <span>
                        锁定期{{=item.regular_date_num}}天
                    </span>
                    {{?}}
                    {{?item.type == 11}}
                    <span style="margin-left:0.1rem;">
                                    不包电费
                                </span>
                    {{?}}
                    {{?item.is_only_newbie == 1}}
                    <span>
                                    新手专享
                                </span>
                    {{?}}
                    {{?item.is_installment ==1}}
                        <span style="margin-left:0.1rem;background:rgba(255,242,239,1);border-radius:0.04rem;color:rgba(194,56,43,1);">
                            分期购
                        </span>
                    {{?}}
                </p>
                <p class="leastTimeInterval" style="display:{{=item.orinStaus=='waitOpen'?'block':'none'}};"
                   id="hideInterval{{=item.loadedNum+index}}">
                    <span class="intervalHour" id="button{{=item.loadedNum+index}}">
                        <span class="leastHour setBg">00</span><span> &nbsp;:&nbsp;</span>
                        <span class="leastMin setBg">00</span><span> &nbsp;:&nbsp;</span>
                        <span class="leastSes setBg">00</span>
                    </span>
                </p>
            </div>
            <div class="unitPower">
                <p>
                    <span>
                        单份BTC算力
                    </span>
                    <span>
                        {{=item.base_power}}{{=item.currency_code=="BTC"?"T":"M"}}{{?item.type!=11 && item.type!=10}}
                            {{?item.more_power_percent}}
                                +{{=item.more_power_percent}}%
                            {{?}}
                        {{?}}
                    </span>
                </p>
                <p style="display:{{=item.is_bhp_pos==1?'flex':'none'}}">
                            <span>
                                单份BHP参配算力
                            </span>
                    <span style="color:#262626;">{{=item.bhp_power}}{{=item.currency_code=="BTC"?"T":"M"}}</span>
                </p>
                <!-- <p>
                    <span>
                        单份合约算力
                    </span>
                    <span>
                        {{=item.base_power}}
                        {{?item.currency_code=="BTC"}}
                            T
                        {{??}}
                            M
                        {{?}}
                        {{= item.more_power_percent<=0? "": ( '+'+item.more_power_percent+ '%')}}
                    </span>
                </p> -->
                <p>
                    <span>
                        单份金额
                    </span>
                    {{?(item.usdtPrice && item.cnyPrice)}}
                    <span style="color:#ff7c34;">{{=item.cnyPrice}}<span
                            style="padding-left: 0.02rem;font-size:0.2rem;">&nbsp;CNY</span>/&nbsp;{{=item.usdtPrice}}<span
                            style="padding-left: 0.02rem;font-size:0.2rem;">&nbsp;USDT</span> </span>
                    {{??}}
                    <span style="color:#ff7c34;">
                                    {{=item.cnyPrice ? item.cnyPrice :item.usdtPrice}}<span
                            style="padding-left: 0.02rem;font-size:0.2rem;">&nbsp;{{=item.cnyPrice ? "CNY" :"BCNY"}}</span>
                                </span>
                    {{?}}
                </p>
                <p style="display:{{=item.is_show==1?'flex':'none'}};">
                            <span>
                                日挖矿收益
                            </span>
                    <span style="color:#ff7c34;">
                                约{{=String(item.predict_income).replace(/([0-9]+\.[0-9]{0,2})[0-9]*/, "$1")}}CNY/份
                            </span>
                </p>
                {{?item.type==11}}
                <p>
                                <span>
                                    合约电价
                                </span>
                    <span style="color:#ff7c34;">{{=item.elecPriceCny}}<span
                            style="padding-left: 0.02rem;font-size:0.2rem;">&nbsp;CNY/度</span>/&nbsp;{{=item.elecPriceUsdt}}<span
                            style="padding-left: 0.02rem;font-size:0.2rem;">&nbsp;USDT/度</span> </span>
                </p>
                {{?}}
                {{?item.type==11 || item.type==10}}
                <p>
                    <span>
                        预估收益率
                    </span>
                    <span>
                        约{{=item.income_ratePre}}%
                    </span>
                </p>
                {{?}}
            </div>
            {{?item.type==0}}
            <img src="../../image/iconactivityx.png"
                 style="position: absolute;top:0;right: 0;z-index: 2;width: 0.84rem;height: 0.4rem;">
            {{??}}
            {{?item.orinStaus=="waitOpen"}}
            <img src="../../image/iconactivityxa.png"
                 style="position: absolute;top:0;right: 0;z-index: 2;width: 0.84rem;height: 0.4rem;">
            {{?}}
            {{?}}
        </div>
        <div>
            <p>
                <span style="margin-right: 0.1rem;">
                    剩余算力
                </span>
                <span style="font-size: 0.26rem;color:rgba(38,38,38,1);">
                    {{=item.num_leftTotalPower}}{{=item.unit_name}}
                </span>
            </p>
            <p>
                <span style="margin-right: 0.1rem;">
                    开挖时间:
                </span>
                <span>
                    {{=item.time_income}}
                </span>
            </p>
        </div>
        <img src="../../image/iconyishouqingx.png" style="display:{{=item.num_left>0? 'none':'block'}};">
    </li>
    {{~}}
</script>
    <!-- 转让列表 -->
    <script type="text/html" id="tranferListData">
    {{~it:item:index}}
    <li style="margin-top:0.2rem;" data-machineID="{{=item.orderId}}" data-status="{{=item.state}}"
        data-isPos="{{=item.isBhpPos}}" data-power="{{=item.myTdPower}}" data-isSelf="{{=item.is_self}}">
        <!-- {{=item.state==1?"已转让":"立即承接"}} -->
        <p>
            <img src="{{=item.avatar}}"> <b class="userName" style="font-size: 0.24rem;"> {{=item.username}} </b>
            <img src="{{=item.gradeImg}}" style="width: auto;height: 0.4rem;margin-left: 0.1rem;border-radius: 0">
            <span style="background-color:{{=item.isBhpPos==1?'#ffd203':'#d0d4da'}};display:{{=item.isBhpPos==1?'inline':'none'}};margin-left: 0.1rem">双挖</span>
            {{?item.is_float==1 && item.isBhpPos!=1}}
            <span style="background-color:{{=item.isFloatPower==1?'#a5d780':'#d0d4da'}};">达标上浮</span>
            {{?}}
        </p>
        <div class="showPrice">
            <div>
                <p>
                        <span>
                            转让单价
                        </span>
                    <span style="color:#FF7C34;">
                            {{=item.goods_deposit}} {{=item.paymentCurrencyCode}}
                        </span>
                </p>
                <p>
                        <span>
                            转让总额
                        </span>
                    <span style="color:#FF7C34;">
                            {{=item.total_deposit}} {{=item.paymentCurrencyCode}}
                        </span>
                </p>
                <p>
                        <span>
                            分币比例
                        </span>
                    <span style="color: #626262">
                            {{=item.distributionRate}} %
                        </span>
                </p>
                <p>
                        <span>
                            转让BTC算力
                        </span>
                    <span style="color: #626262">
                            {{=item.total_power}}T
                        </span>
                </p>
                <p style="display:{{=item.isBhpPos==1?'flex':'none'}};">
                        <span>
                            转让BHP参配算力
                        </span>
                    <span style="color: #626262">
                            {{=item.bhpPower}}T
                        </span>
                </p>
                <p>
                        <span>
                            转让时间
                        </span>
                    <span style="color: #626262">
                            {{=item.operateTime}}
                        </span>
                </p>
            </div>
        </div>
    </li>
    {{~}}
</script>
    <!--服务合约-->
    <script type="text/html" id="md">
    {{~it:item:index}}
    <li data-id={{=item.id}} data-name={{=item.name}} data-user={{=item.enemy}}
        data-constractId={{=item.server_chinese_id}}>
        <p class="name">{{=item.name}}</p>
        <p class="managerTxt">
            <img src="../../image/bluemanager.png" alt="">
            <span> 合约销售方：<span class="manager">{{=item.enemy}}</span></span>
        </p>
        <div class="detail">
            <span class="title">剩余份额</span><span class="content leftNum">{{=item.inventory}}份</span>
            <span class="title">最高止损率</span><span class="content lowGet">{{=item.min_inventory_t}}%</span>
        </div>
        <div class="detail">
            <span class="title">合约周期</span><span class="content agreementTime">{{=item.period}}天</span>
            <span class="title">最高止盈率</span><span class="content topGet">{{=item.max_inventory_t}}%</span>
        </div>
        <div class="showStartPrice" style="width:100%">
               <span>
                   起购金额(每T)
               </span>
            <span style="color:#FF7C34;">
                   {{=item.price.final_price}}CNY/{{=item.price.final_usdt_price}}USDT
               </span>
        </div>
    </li>
    {{~}}
</script>
</body>

</html>